﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:local="clr-namespace:urBook.Gui"
	mc:Ignorable="d"
	x:Class="urBook.Gui.ContactView"
	x:Name="UserControl">
    <FlowDocumentReader ViewingMode="Scroll" HorizontalContentAlignment="Stretch"
        IsFindEnabled="False" IsPageViewEnabled="False" IsTwoPageViewEnabled="False" IsManipulationEnabled="False" DataContext="{Binding Source={StaticResource ContactObject}}">
        <FlowDocument>
            <Table Name="ItemsTable" CellSpacing="8" TextAlignment="Justify" Margin="0" LineHeight="24">
                <Table.Columns>
                    <TableColumn Width="156"/>
                    <TableColumn />
                    <TableColumn />
                    <TableColumn />
                    <TableColumn />
                    <TableColumn />
                </Table.Columns>
                <TableRowGroup>
                    <TableRow>
                        <TableCell RowSpan="3">
                            <BlockUIContainer>
                                <Image x:Name="image" Source="data/images/unknown.png" Margin="8" MinWidth="128" Width="128" Height="128" HorizontalAlignment="Left" VerticalAlignment="Center" MouseLeftButtonDown="image_MouseDown" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell>
                            <BlockUIContainer>
                                <TextBox x:Name="title" Text="{Binding title}" ToolTip="Title" Margin="8" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="16" FontWeight="Bold" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" DataContext="{Binding}" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell ColumnSpan="2">
                            <BlockUIContainer>
                                <TextBox x:Name="firstName" Text="{Binding name.firstName}" ToolTip="First Name" Margin="8" VerticalAlignment="Center" HorizontalAlignment="Stretch" FontSize="16" FontWeight="Bold" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell ColumnSpan="2">
                            <BlockUIContainer>
                                <TextBox x:Name="lastName" Text="{Binding name.lastName}" Margin="8" ToolTip="Last Name" VerticalAlignment="Center" HorizontalAlignment="Stretch" FontSize="16" FontWeight="Bold" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                    </TableRow>
                    <TableRow>
                        <TableCell ColumnSpan="5">
                            <BlockUIContainer>
                                <TextBox x:Name="company" Text="{Binding company}" Margin="8" ToolTip="Company Name" MinWidth="64" VerticalAlignment="Center" FontWeight="Bold" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                    </TableRow>
                    <TableRow>
                        <TableCell ColumnSpan="5">
                            <BlockUIContainer>
                                <TextBox x:Name="url" Text="{Binding url}" Margin="8" ToolTip="URL" VerticalAlignment="Center" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                    </TableRow>
                    <TableRow>
                        <TableCell RowSpan="2">
                            <BlockUIContainer>
                                <Label Content="Home Address:" HorizontalAlignment="Left"  Margin="8" MinWidth="64" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell ColumnSpan="5">
                            <BlockUIContainer>
                                <TextBox x:Name="homeStreet" Text="{Binding homeAddress.street}" Margin="8" ToolTip="Street" VerticalAlignment="Center" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                    </TableRow>
                    <TableRow>
                        <TableCell ColumnSpan="2">
                            <BlockUIContainer>
                                <TextBox x:Name="homeCity" Text="{Binding homeAddress.city}" Margin="8" ToolTip="City" VerticalAlignment="Center" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell>
                            <BlockUIContainer>
                                <TextBox x:Name="homeState" Text="{Binding homeAddress.state}" Margin="8" ToolTip="State" VerticalAlignment="Center" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell>
                            <BlockUIContainer>
                                <TextBox x:Name="homeZip" Text="{Binding homeAddress.postalCode}" Margin="8" ToolTip="Zip" VerticalAlignment="Center" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell>
                            <BlockUIContainer>
                                <TextBox x:Name="homeCountry" Text="{Binding homeAddress.country}" Margin="8" ToolTip="Country" HorizontalAlignment="Stretch" VerticalAlignment="Center" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                    </TableRow>
                    <TableRow>
                        <TableCell RowSpan="2">
                            <BlockUIContainer>
                                <Label Content="Work Address:" HorizontalAlignment="Left"  Margin="8" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell ColumnSpan="5">
                            <BlockUIContainer>
                                <TextBox x:Name="workStreet" Text="{Binding workAddress.street}" Margin="8" ToolTip="Street" VerticalAlignment="Center" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                    </TableRow>
                    <TableRow>
                        <TableCell ColumnSpan="2">
                            <BlockUIContainer>
                                <TextBox x:Name="workCity" Text="{Binding workAddress.city}" Margin="8" ToolTip="City" HorizontalAlignment="Stretch" VerticalAlignment="Center" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell>
                            <BlockUIContainer>
                                <TextBox x:Name="workState" Text="{Binding workAddress.state}" Margin="8" ToolTip="State" VerticalAlignment="Center" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell>
                            <BlockUIContainer>
                                <TextBox x:Name="workZip" Text="{Binding workAddress.postalCode}" Margin="8" ToolTip="Zip" HorizontalAlignment="Stretch" VerticalAlignment="Center" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell>
                            <BlockUIContainer>
                                <TextBox x:Name="workCountry" Text="{Binding workAddress.country}" Margin="8" ToolTip="Country" HorizontalAlignment="Stretch" VerticalAlignment="Center" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                    </TableRow>
                    <TableRow>
                        <TableCell>
                            <BlockUIContainer>
                                <Label Content="Telephones:" HorizontalAlignment="Left" Margin="8"  VerticalAlignment="Center"/>
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell ColumnSpan="4">
                            <BlockUIContainer>
                                <ListBox x:Name="phones" Margin="8" HorizontalAlignment="Stretch" MinHeight="40"  VerticalAlignment="Center" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Center" Padding="0" MouseDoubleClick="PhonesList_MouseDoubleClick" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell>
                            <BlockUIContainer>
                                <Button x:Name="AddPhone" Margin="12" Padding="4" HorizontalAlignment="Right" VerticalAlignment="Center" Content="New Phone" Click="AddPhone_Click" MaxHeight="32" />
                            </BlockUIContainer>
                        </TableCell>
                    </TableRow>
                    <TableRow>
                        <TableCell>
                            <BlockUIContainer>
                                <Label Content="Emails:" HorizontalAlignment="Left"  Margin="8" VerticalAlignment="Center"/>
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell ColumnSpan="4">
                            <BlockUIContainer>
                                <ListBox x:Name="emails" Margin="8" HorizontalAlignment="Stretch" MinHeight="40" VerticalAlignment="Center" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Center" Padding="0" MouseDoubleClick="EmailsList_MouseDoubleClick" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell>
                            <BlockUIContainer>
                                <Button x:Name="AddEmail" Margin="12" Padding="4" HorizontalAlignment="Right" VerticalAlignment="Center" Content="New Email" Click="AddEmail_Click" MaxHeight="32" />
                            </BlockUIContainer>
                        </TableCell>
                    </TableRow>
                    <TableRow>
                        <TableCell>
                            <BlockUIContainer>
                                <Label Content="Notes:"  Margin="8" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell ColumnSpan="5">
                            <BlockUIContainer>
                                <TextBox x:Name="notes" Text="{Binding notes}" TextWrapping="Wrap" Margin="8" ToolTip="Notes"  VerticalAlignment="Center" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                    </TableRow>
                    <TableRow>
                        <TableCell>
                            <BlockUIContainer>
                                <Label Content="Groups:"  Margin="8" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell ColumnSpan="3">
                            <BlockUIContainer>
                                <TextBox x:Name="groups" Margin="8" ToolTip="Groups" MinWidth="384"  VerticalAlignment="Center" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Padding="0" TextChanged="TextBox_TextChanged" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell>
                            <BlockUIContainer>
                                <Button x:Name="Save" Margin="8" Padding="8,0" HorizontalAlignment="Center" VerticalAlignment="Center" Content="Save" Click="Save_Click" />
                            </BlockUIContainer>
                        </TableCell>
                        <TableCell>
                            <BlockUIContainer>
                                <Button x:Name="Revert" Margin="8" Padding="8,0" HorizontalAlignment="Center" VerticalAlignment="Center" Content="Revert Back" Click="Revert_Click" />
                            </BlockUIContainer>
                        </TableCell>
                    </TableRow>
                </TableRowGroup>
            </Table>
        </FlowDocument>
    </FlowDocumentReader>
</UserControl>